<div class="easyui-layout" data-options="fit:true">
    <form id="detailFrom" method="post">
        <div data-options="region:'center'">
            <div id="targetInfo" class="easyui-tabs">
                <div title="【借款人信息】">
                    <table class="inputTable">
                        <tr>
                            <td>借款人信息</td>
                        </tr>
                        <tr>
                            <td>真实姓名</td>
                            <td><input name="realname" type="text" maxlength="6" minlength="2"/></td>
                            <td>性别</td>
                            <td><input name="sex" type="text" class="easyui-combobox"
                                       data-options="url:'/dictionary/swldsex'"/></td>
                        </tr>
                        <tr>
                            <td>年龄</td>
                            <td><input name="age" type="text"/></td>
                            <td>身份证号码</td>
                            <td><input name="idcard" type="text"/></td>
                        </tr>
                        <tr>
                            <td>联系电话</td>
                            <td><input name="mobile" type="text" maxlength="11"/></td>
                            <td>教育情况</td>
                            <td><input name="edustate" type="text" class="easyui-combobox"
                                       data-options="url:'/dictionary/swldedustate'"/></td>
                        </tr>
                        <tr>
                            <td>婚育情况</td>
                            <td><input name="marriagestate" type="text" class="easyui-combobox"
                                       data-options="url:'/dictionary/swldmarriagestate'"/></td>
                            <td>户籍所在地</td>
                            <td><input name="hjaddress" type="text"/></td>
                        </tr>
                        <tr>
                            <td>现居地</td>
                            <td><input name="xxjzaddress" type="text"/></td>
                            <td>月收入</td>
                            <td><input name="ygzsr" type="text"/></td>
                        </tr>
                        <tr>
                            <td>年收入</td>
                            <td><input name="nzsr" type="text"/></td>
                            <td>住房情况</td>
                            <td><input name="housestate" type="text" class="easyui-combobox"
                                       data-options="url:'/dictionary/swldhousestate'"/></td>
                        </tr>
                        <tr>
                            <td>购车情况</td>
                            <td><input name="gcqk" type="text" class="easyui-combobox"
                                       data-options="url:'/dictionary/swldgcqk'"/></td>
                            <td>职业类别</td>
                            <td><input name="occutype" type="text" class="easyui-combobox"
                                       data-options="url:'/dictionary/swldoccutype'"/></td>
                        </tr>
                        <tr>
                            <td>入职日期</td>
                            <td><input name="wjoindate" type="text"/></td>
                            <td>每月还贷金额</td>
                            <td><input name="hdje" type="text"/></td>
                        </tr>
                        <tr>
                            <td>居住年限</td>
                            <td><input name="bdjznx" type="text"/></td>
                            <td>工作单位类型</td>
                            <td><input name="wcompanytype" type="text"/></td>
                        </tr>
                        <tr>
                            <td>工作单位行业</td>
                            <td><input name="gszyyw" type="text"/></td>
                            <td>公司规模</td>
                            <td><input name="gsgm" type="text"/></td>
                        </tr>
                        <tr>
                            <td>抵押物信息</td>
                            <td></td>
                            <td></td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>抵押物类型</td>
                            <td><input name="comname" type="text"/></td>
                            <td>详情</td>
                            <td><input name="suggestion" type="text"/></td>
                        </tr>
                        <tr>
                            <td>评估公司</td>
                            <td><input name="mevalinsti" type="text"/></td>
                            <td>评估金额</td>
                            <td><input name="mgroseval" type="text"/></td>
                        </tr>
                        <tr>
                            <td>共借人信息</td>
                            <td></td>
                            <td></td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>真实姓名</td>
                            <td><input name="grealname" type="text"/></td>
                            <td>性别</td>
                            <td><input name="gsex" type="text" class="easyui-combobox"
                                       data-options="url:'/dictionary/swldsex'"/></td>
                        </tr>
                        <tr>
                            <td>年龄</td>
                            <td><input name="gage" type="text"/></td>
                            <td>身份证号码</td>
                            <td><input name="gidcard" type="text"/></td>
                        </tr>
                        <tr>
                            <td>手机号码</td>
                            <td><input name="gmobile" type="text"/></td>
                            <td>职业类别</td>
                            <td><input name="goccutype" type="text" class="easyui-combobox"
                                       data-options="url:'/dictionary/swldoccutype'"/></td>
                        </tr>
                        <tr>
                            <td>与借款人关系</td>
                            <td><input name="gyjkrgx" type="text" class="easyui-combobox"
                                       data-options="url:'/dictionary/swldgyjkrgx'"/></td>
                            <td></td>
                            <td></td>
                        </tr>
                    </table>
                </div>
                <div title="【标的信息】">
                    <table class="inputTable">
                        <tr>
                            <td>标的信息</td>
                        </tr>
                        <tr>
                            <td>借款编号</td>
                            <td><input name="loanNumber" type="text"/></td>
                            <td>借款用户名</td>
                            <td><input name="telephone" type="text"/></td>
                        </tr>
                        <tr>
                            <td>真实姓名</td>
                            <td><input name="bdrealname" type="text"/></td>
                            <td>项目所在省</td>
                            <td><input name="province" type="text"/></td>
                        </tr>
                        <tr>
                            <td>项目所在市</td>
                            <td><input name="city" type="text"/></td>
                            <td>借款类型</td>
                            <td><input name="productname" type="text" class="easyui-combobox"
                                       data-options="url:'/dictionary/loanType'"/></td>
                        </tr>
                        <tr>
                            <td>借款金额</td>
                            <td><input name="htje" type="text"/></td>
                            <td>借款期限</td>
                            <td><input name="htqx" type="text"/></td>
                        </tr>
                        <tr>
                            <td>预期年化利率</td>
                            <td><input name="nhsyl" type="text"/></td>
                            <td>还款方式</td>
                            <td><input name="hkfs" type="text" class="easyui-combobox"
                                       data-options="url:'/dictionary/payBackType'"/></td>
                        </tr>
                        <tr>
                            <td>融资期限</td>
                            <td><input name="rzqx" type="text"/></td>
                            <td>还款期数</td>
                            <td><input name="hkqs" type="text"/></td>
                        </tr>
                        <tr>
                            <td>置顶排序</td>
                            <td><input name="sortFirst" type="text" class="easyui-combobox"
                                       data-options="url:'/dictionary/sortFirst'"/></td>
                            <td>平台收取费用率</td>
                            <td><input name="fwf" type="text"/></td>
                        </tr>
                        <tr>
                            <td>借款描述</td>
                            <td><input type="text" name="borrowuse" style="width: 300px;height: 100px"/></td>
                        </tr>
                        <tr>
                            <td>风控师意见</td>
                            <td><input type="text" name="remark" style="width: 300px;height: 100px"/></td>
                            <td></td>
                            <td></td>
                        </tr>
                    </table>
                </div>
                <div title="【风控信息认证】">
                    <div align="right">
                        <a href="javascript:;" class="easyui-linkbutton info downloadBath"
                           data-options="iconCls:'icon-package_link'">打包下载</a>
                        <a href="javascript:;" class="easyui-linkbutton info uploadPic"
                           data-options="iconCls:'fa fa-cloud-upload'">上传</a>
                        <div align="left" id="nav">
                            <ul id="msg">
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<div id="uploadWin" class="easyui-window"></div>

<script type="text/javascript">
    var findTarget = '/target/findTargetById';//一条审核数据
    var uploadUrl = "/page/project/targetPicUpload.html";
    var removePic = "/target/removePic"
    var rows = $("#list").datagrid('getChecked');
    $(function () {
        $(".easyui-combobox").combobox({disabled: true});
        $("#sortFirst").combobox({disabled: false});
        $("input[type=text]").attr("disabled", true);
        //批量下载
        $(".downloadBath").click(function () {
            var rows = $("#list").datagrid('getChecked');
            window.location = "/target/download/attachment/package?id=" + rows[0].id;
        });
        //上传图片
        $(".uploadPic").click(function () {
            $("#uploadWin").window({
                width: 500, height: 300, "onLoad": function () {
                    $("#uploadTargetId").val(rows[0].id);
                }, title: "提示"
            }).window("open").window("center").window("refresh", uploadUrl);
        });
        try {
            var titles = [];
            titles["2"] = "身份证正反面";
            titles["3"] = "收入证明";
            titles["4"] = "工作证明";
            titles["5"] = "居住地证明";
            titles["6"] = "信用报告";
            titles["8"] = "房产证明";
            titles["12"] = "其他";
            titles["19"] = "车辆证明";
            titles["20"] = "户口信息";
            titles["21"] = "银行流水";
            $.get(findTarget, {id: rows[0].id}, function (msg) {
                if (msg.state == 'SUCCESS') {
                    $("#detailFrom").form('load', msg.data);
                    var json = eval("(" + msg.data.otherContent + ")");
                    $.each(json, function (i, item) {
                        if (i == "proves") {
                            var provesJson = JSON.parse(item);
                            $.each(provesJson, function (index, value) {
                                var obj = provesJson[index];
                                var otype = obj.otype;
                                var html = '<li class="attachBox">' +
                                        '<img class="fresco" data-fresco-group="example"' +
                                        'href="' + obj.filecontent + '"' +
                                        'src="' + obj.filecontent + '"' +
                                        'title="' + titles[otype] + '"' +
                                        'width="150px" height="200px" data-fresco-caption="' + titles[otype] + '"/>' +
                                        '<div  >' +
                                        '<a href="javascript:;" class="icon-cancel panel-tool-a"' +
                                        'style="text-decoration: none">&nbsp; </a>&nbsp;' +
                                        '<a href="javascript:;" class="icon-arrow_down panel-tool-a downloadImg"' +
                                        'style="text-decoration: none">&nbsp; </a>' +
                                        '</div>' +
                                        ' </li>'
                                $("#msg").append(html);
                            });
                        } else {
                            $("input[name=" + i + "]").val(item);
                        }
                    });


                    //下载单个文件
                    $(".downloadImg").click(function () {
                        var imgUrl = $(this).parent().prev().attr("src");
                        window.location = "/download/" + imgUrl;
                    })
                    //删除图片
                    $(".icon-cancel").click(function () {
                        var fileContent = $(this).parent().prev().attr("href");
                        var box = $(this).parent().parent();
                        $.get(removePic, {id: rows[0].id, fileContent: fileContent}, function (data) {
                            if (data.state == 'SUCCESS') {
                                box.remove();
                            } else {
                                $.messager.show({title: '操作提示', msg: msg.message, timeout: 2000, showType: 'slide'});
                            }
                        });
                    });
                } else {
                    $.messager.show({title: '操作提示', msg: msg.message, timeout: 2000, showType: 'slide'});
                }
            });
        } catch (e) {
        }
    });


</script>

